﻿using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Net;
using HtmlAgilityPack;
using System.Collections.Generic;

namespace WhySoSeries
{
    public static class WebUtilities
    {

        public static HtmlDocument GetHtmlDocument(string url)
        {
            HtmlDocument doc = null;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Proxy = null;
            doc = new HtmlDocument();
            doc.Load(request.GetResponse().GetResponseStream());
            return doc;
        }

        public static string GetPageContent(string url)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Proxy = null;
            StreamReader stream = new StreamReader(request.GetResponse().GetResponseStream());
            return stream.ReadToEnd();
        }
    }
}
